<?xml version="1.0"
      encoding="UTF-8"
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>leo在Py2.5中的失败尝试</title>
<meta name="generator" content="http://txt2tags.sf.net" />
</head>
<body>

<div class="header" id="header">
<a name='toptopTlJTVzdaT' id='toptopTlJTVzdaT'></a><h1>leo在Py2.5中的失败尝试</h1>
<h2>-- 中文应用问题是国人永远的心痛哪</h2>
</div>

<div class="toc" id="toc">
  <ol>
  <li><a href="#toc1R0VYQ0IyR">背景</a>
    <ul>
    <li><a href="#toc2R0VYRENMU">1.1. 思路</a>
    </li>
    <li><a href="#toc3R0VYREVMU">1.2. 安装步骤</a>
    </li>
    <li><a href="#toc4R0VYREdMU">1.3. 失败的结果</a>
    </li>
    </ul>
  </li>
  </ol>

</div>
<div class="body" id="body">
<a id="toc1R0VYQ0IyR" name="toc1R0VYQ0IyR"></a>
<h1><A href='#toptopTlJTVzdaT'> 1. 背景 </A></h1>
<ul>
<li>折腾了两天将Python2.5 编译了5回也没有搞定,询问大家是否有经验了!
</li>
<li>一直知道 LEO 在Linux 下面的中文支持问题是Tk 造的孽
 <ul>
 <li><a href="http://linux.ccidnet.com/art/738/20060430/545737_1.html">http://linux.ccidnet.com/art/738/20060430/545737_1.html</a>
 </li>
 </ul>
</li>
</ul>

<ul>
<li>但是这两日怎么搞都不成！
</li>
<li>详细记录在<a href="http://wiki.woodpecker.org.cn/moin/ZoomQuiet/2007-04-27">啄木鸟维基-ZoomQuiet/2007-04-27</a>
 <ul>
 <li><b>请大家给点建议吧</b>
 </li>
 <li><a href="http://sourceforge.net/forum/forum.php?thread_id=1724164&amp;forum_id=10227">leo sf.net 讨论</a>
 </li>
 </ul>
</li>
</ul>

<a id="toc2R0VYRENMU" name="toc2R0VYRENMU"></a>
<h2><A href='#toptopTlJTVzdaT'> 1.1. 思路 </A></h2>
<p>
我的步骤和思路:
</p>
<ol>
<li>不能影响现存的Py2.4 环境
</li>
<li>使用Py2.5 进行尝试
<p></p>
</li>
</ol>

<dl>
<dt>因为: </dt><dd>
  LEO 仅仅需要Python with Tk+Pwm
  <ul>
  <li>(不过要求Tcl 不能使用线程支持参数)
  </li>
  </ul>
</dd>
<dt>所以:</dt><dd>
  只要安装好Py2.5 就可以:
</dd>
</dl>

<a id="toc3R0VYREVMU" name="toc3R0VYREVMU"></a>
<h2><A href='#toptopTlJTVzdaT'> 1.2. 安装步骤 </A></h2>
<ol>
<li>安装最新 Tcl/Tk 
<pre>
download cvs snapshots from ftp://ftp.tcl.tk/pub/tcl/nightly-cvs/
tcl/unix$ ./configure --enable-shared --enable-gcc
$ make clean &amp;&amp; make 
$ sudo make install
...
/tk/unix$ ./configure --enable-xft
$ make clean &amp;&amp; make 
$ sudo make install
...
</pre>
<p></p>
</li>
</ol>

<dl>
<dt>安装Python2.5 并绑定Tk8.5</dt><dd>
  根据<a href="http://blog.csdn.net/fyzhao/archive/2006/12/27/1464614.aspx">前人Py2.5安装经验</a>
<p></p>
<pre>
$ sudo cp path/to/libtcl8.5.so /usr/lib/
$ sudo cp path/to/libtk8.5.so /usr/lib/
...
/python2.5-2.5.1.orig$ ./configure --enable-unicode=ucs4 \
  --with-tk   --with-tk-library=/usr/local/lib --with-tk-include=/usr/local/include/tcl8.5 \
  --with-tcl-library=/usr/local/lib --with-tcl-include=/usr/local/include/tcl8.5 
$  make clean &amp;&amp; make
$  make test
</pre>
<p></p>
</dd>
<dt>安装 LEO</dt><dd>
<pre>
cp -r Pmw /usr/local/lib/python2.5/site-packages/
cp -r leo-4-4-3-alpha-2 /opt/bin/
</pre>
</dd>
</dl>

<a id="toc4R0VYREdMU" name="toc4R0VYREdMU"></a>
<h2><A href='#toptopTlJTVzdaT'> 1.3. 失败的结果 </A></h2>
<ul>
<li>OK,结果 在 <code>/opt/bin/leo-4-4-3-alpha-2/src</code> 中直接调用leo.py 可以运行;
</li>
<li>但是LEO 不能正當影响 Ctrl+c|v|s 等等各种操作;直接就死了...
<pre>
/opt/bin/leo-4.4.3a2/src$ python2.5 leo.py
reading settings in /opt/bin/leo-4.4.3a2/config/leoSettings.leo
reading /home/zoomq/.leoRecentFiles.txt
rst3 plugin: SilverCity not loaded
rst3 plugin not loaded: can not load docutils
Traceback (most recent call last):

  File ''/opt/bin/leo-4.4.3a2/src/leoEditCommands.py'', line 7903, in getAspellWithCtypes
    self.aspell = aspell = ctypes.CDLL(g.os_path_join(self.aspell_bin_dir, ''aspell-15.dll''))

  File ''/usr/local/lib/python2.5/ctypes/__init__.py'', line 340, in __init__
    self._handle = _dlopen(self._name, mode)

OSError: /opt/bin/leo-4.4.3a2/src/c:\aspell\bin/aspell-15.dll: cannot open shared object file: No such file or directory

Traceback (most recent call last):
  File ''leo.py'', line 353, in &lt;module&gt;
    run()
  File ''leo.py'', line 138, in run
    g.app.gui.runMainLoop()
  File ''/opt/bin/leo-4.4.3a2/src/leoTkinterGui.py'', line 186, in runMainLoop
    self.root.mainloop()
  File ''/usr/local/lib/python2.5/lib-tk/Tkinter.py'', line 1023, in mainloop
    self.tk.mainloop(n)
  File ''/usr/local/lib/python2.5/site-packages/Pmw/Pmw_1_2/lib/PmwBase.py'', line 1751, in __call__
    _reporterror(self.func, args)
  File ''/usr/local/lib/python2.5/site-packages/Pmw/Pmw_1_2/lib/PmwBase.py'', line 1777, in _reporterror
    msg = exc_type + ' Exception in Tk callback\n'
TypeError: unsupported operand type(s) for +: 'type' and 'str'
</pre>
<p></p>
<b>到底咋回事儿泥？！</b>
</li>
</ul>

<hr class="light" />
<ul>
<li>t2t渲染:: 2010-10-09 02:21:36
</li>
<li>动力源自::<b><a href="http://txt2tags.sf.net">txt2tags</a></b>
</li>
</ul>

</div>

<!-- xhtml code generated by txt2tags 2.4 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags ./Zen/pythonic/leo-py25-bad-chinese-2007-04-27-18-00.t2t -->
</body></html>
